﻿@model Forum
@{    
    Layout = "";
    var _parent = ViewData["Parent"] != null ? (Forum)ViewData["Parent"] : null;
    int _parentID = _parent != null ? _parent.ID : 0;
    string _title = _parent != null ? _parent.Title : Html.Global("forums", "Community");
    string _icon = (bool)ViewData["IsGroup"] ? Url.Content("~/content/images/icon_comments_16.png") : Url.Content("~/content/images/comment.png");
}
@using (Ajax.BeginAjaxForm("Create", "Forum", new jQueryAjaxOptions()
   {
       HttpMethod = "POST",
       AutoBlocking = true,
       OnSuccess = " if ($('#__forum_id').val() && parseInt($('#__forum_id').val())) $(\"#forumTree\").dtree(\"addNode\",$(\"<li data-isgroup='" + ViewData["IsGroup"].ToString()
       + "' data-key='\"+$('#__forum_id').val()+\"'><a href='javascript:void(0);'><img class='d-treenode-img' src='"
       + _icon + "' alt=''><span>\"+$('#Forum_Title').val()+\"</span></a></li>\"));"
   }, new RouteValueDictionary(new { id = _parentID }), null))
{ 
    @Html.AntiForgeryToken() 
    <div style="padding: 10px;">
        <div style="margin-bottom: 10px;">
            @if ((bool)ViewData["IsGroup"])
            {
                <img src="@Url.Content("~/Content/Images/comments.png")" alt="" style="float: left;" />
                <h3 style="margin: 5px 0px 0px 5px; float: left;">
                    @Html.Global("forums", "AddSubGroupTo")<u>
                        @_title</u>
                </h3>
            }
            else
            { 
                <img src="@Url.Content("~/Content/Images/icon-comment-32.png")" alt="" style="float: left;" />
                <h3 style="margin: 5px 0px 0px 5px; float: left;">
                    @Html.Global("forums", "AddSubForumTo")<u>
                        @_title</u>
                </h3>
            }
            <div style="clear: both;">
            </div>
        </div>
        @{ Html.RenderPartial("ForumForm", ViewData); }
        @if (WebSiteContext.Current.IsAuthorized<DNA.Mvc.Community.Controllers.ForumController>("Create"))
        {
            <div style="margin-top: 5px; padding: 5px; text-align: center;">
                @( Ajax.Dna().Button()
                   .Submit()
                   .ImageIcons(Url.Content("~/content/images/icon_save.gif"))
                   .LocText("RES_SAVE")
                   .GetHtml()
            )
            </div>
        }
    </div>
}
@Html.StartupScripts()
